package FrontEnd;

public class IntermediateCodeGenerator {
	// This is for the output of the IR file.
	private String irFliename;
	private int lineCount = 0;
	
	private IntermediateCodeGenerator(String irFilename){
		this.irFilename = irFilename;
	}
	
	// Where to defined the FileWriter & PrintWriter?
	private  gen(String codeLine){
		lineCount++;
		System.out.println(codeline + "\n");
	}
	
	//	assign_stmt : lvalue ASGN expression SEMI   
	//	           	;
	// example: i = 1 + 2 + 3;
	// Since the Yacc parsing is bottom up, calling this process function should ensure that the 
	// lValue and expression is has correct value of code(if needed) and addr.
    public void ProcessAssignment(TreeNode assignStmt, TreeNode lValue, TreeNode expression){
    	//TODO: type-check and type conversion
    	assignStmt.code = expression.code + gen(lValue.addr + " " + expression.addr);
    }
}
